const state = {
	isPermissionAlertShow: false,
	permissionType: '',
	modalText: {
			11: {
				title: '相册权限说明',
				content: '莲众APP需要您的同意，才能访问您的相册，并选取一张您的照片/图片作为实名认证信息、更新头像，请您确认授权，否则无法使用该功能',
			},
			12: {
				title: '相册权限说明',
				content: '便于您使用该功能拍摄身份证、头像、等信息，请您确认授权，否则无法使用该功能',
			},
			22: {
				title: '相册权限说明',
				content: '便于您使用该功能拍摄身份证、头像、等信息，请您确认授权，否则无法使用该功能',
			},
		}
}

const mutations = {
	setPermissionAlertShowFalse(state, permission){
		state.permissionType = permission.permissionType
		state.isPermissionAlertShow = permission.isPermissionAlertShow
	},
	goSystemSet(state, code){
		uni.showModal({
			title: state.modalText[code].title,
			content: state.modalText[code].content,
			confirmText: '去设置',
			success: (e) => {
				if (!e.confirm) return;
				uni.openAppAuthorizeSetting()
			}
		})
	},
	getSetting(state, type){
		const appAuthorizeSetting = uni.getAppAuthorizeSetting()
		console.log(appAuthorizeSetting.locationAuthorized == 'authorized');
		if(type == 'location') return (appAuthorizeSetting.locationAuthorized == 'authorized')
	}
	
}

const actions = {}

const getters = {
	
}

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters
}
